/**
 * <copyright>
 *
 * Copyright (c) 2011 Zeligsoft (2009) Limited
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: 
 *   Zeligsoft (2009) Limited - Initial API and implementation
 *
 * </copyright>
 *
 */
package org.omg.deployment.parts.forms;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent;
import org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent;
import org.eclipse.emf.eef.runtime.api.parts.IFormPropertiesEditionPart;
import org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent;
import org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart;
import org.eclipse.emf.eef.runtime.ui.parts.PartComposer;
import org.eclipse.emf.eef.runtime.ui.parts.sequence.BindingCompositionSequence;
import org.eclipse.emf.eef.runtime.ui.parts.sequence.CompositionSequence;
import org.eclipse.emf.eef.runtime.ui.parts.sequence.CompositionStep;
import org.eclipse.emf.eef.runtime.ui.utils.EditingUtils;
import org.eclipse.emf.eef.runtime.ui.widgets.FormUtils;
import org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableContentProvider;
import org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.omg.deployment.Any;
import org.omg.deployment.Property;
import org.omg.deployment.Requirement;
import org.omg.deployment.ResourceDeploymentDescription;
import org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart;
import org.omg.deployment.parts.DeploymentViewsRepository;
import org.omg.deployment.providers.DeploymentMessages;


/**
 * @author Toby McClean; Zeligsoft (2009) Limited
 * @generated
 */
public class ArtifactDeploymentDescriptionPropertiesEditionPartForm extends CompositePropertiesEditionPart implements IFormPropertiesEditionPart, ArtifactDeploymentDescriptionPropertiesEditionPart {

	protected Text name;
	protected Text location;
	protected Text node;
	protected Text source;
		protected TableViewer execParameter;
		protected List<ViewerFilter> execParameterBusinessFilters = new ArrayList<ViewerFilter>();
		protected List<ViewerFilter> execParameterFilters = new ArrayList<ViewerFilter>();
		protected TableViewer deployRequirement;
		protected List<ViewerFilter> deployRequirementBusinessFilters = new ArrayList<ViewerFilter>();
		protected List<ViewerFilter> deployRequirementFilters = new ArrayList<ViewerFilter>();
		protected TableViewer deployResource;
		protected List<ViewerFilter> deployResourceBusinessFilters = new ArrayList<ViewerFilter>();
		protected List<ViewerFilter> deployResourceFilters = new ArrayList<ViewerFilter>();



	/**
	 * Default constructor
	 * @param editionComponent the {@link IPropertiesEditionComponent} that manage this part
	 * @generated
	 */
	public ArtifactDeploymentDescriptionPropertiesEditionPartForm(IPropertiesEditionComponent editionComponent) {
    super(editionComponent);
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.eef.runtime.api.parts.IFormPropertiesEditionPart#
	 *  createFigure(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
	 * @generated
	 */
	public Composite createFigure(final Composite parent, final FormToolkit widgetFactory) {
    ScrolledForm scrolledForm = widgetFactory.createScrolledForm(parent);
    Form form = scrolledForm.getForm();
    view = form.getBody();
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    view.setLayout(layout);
    createControls(widgetFactory, view);
    return scrolledForm;
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.eef.runtime.api.parts.IFormPropertiesEditionPart#
	 *  createControls(org.eclipse.ui.forms.widgets.FormToolkit, org.eclipse.swt.widgets.Composite)
	 * @generated
	 */
	public void createControls(final FormToolkit widgetFactory, Composite view) {
    CompositionSequence artifactDeploymentDescriptionStep = new BindingCompositionSequence(propertiesEditionComponent);
    CompositionStep propertiesStep = artifactDeploymentDescriptionStep.addStep(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.class);
    propertiesStep.addStep(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.name);
    propertiesStep.addStep(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.location);
    propertiesStep.addStep(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.node);
    propertiesStep.addStep(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.source);
    propertiesStep
      .addStep(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.ExecParameters.class)
      .addStep(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.ExecParameters.execParameter);
    
    propertiesStep
      .addStep(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.Requirements.class)
      .addStep(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.Requirements.deployRequirement);
    
    propertiesStep
      .addStep(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.Resources.class)
      .addStep(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.Resources.deployResource);
    
    
    
    composer = new PartComposer(artifactDeploymentDescriptionStep) {

      @Override
      public Composite addToPart(Composite parent, Object key) {
        if (key == DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.class) {
          return createPropertiesGroup(widgetFactory, parent);
        }
        if (key == DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.name) {
          return 		createNameText(widgetFactory, parent);
        }
        if (key == DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.location) {
          return 		createLocationText(widgetFactory, parent);
        }
        if (key == DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.node) {
          return 		createNodeText(widgetFactory, parent);
        }
        if (key == DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.source) {
          return 		createSourceText(widgetFactory, parent);
        }
        if (key == DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.ExecParameters.class) {
          return createExecParametersGroup(widgetFactory, parent);
        }
        if (key == DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.ExecParameters.execParameter) {
          return createExecParameterTableComposition(widgetFactory, parent);
        }
        if (key == DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.Requirements.class) {
          return createRequirementsGroup(widgetFactory, parent);
        }
        if (key == DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.Requirements.deployRequirement) {
          return createDeployRequirementTableComposition(widgetFactory, parent);
        }
        if (key == DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.Resources.class) {
          return createResourcesGroup(widgetFactory, parent);
        }
        if (key == DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.Resources.deployResource) {
          return createDeployResourceTableComposition(widgetFactory, parent);
        }
        return parent;
      }
    };
    composer.compose(view);
  }
	/**
	 * @generated
	 */
	protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
    Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    propertiesSection.setText(DeploymentMessages.ArtifactDeploymentDescriptionPropertiesEditionPart_PropertiesGroupLabel);
    GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
    propertiesSectionData.horizontalSpan = 3;
    propertiesSection.setLayoutData(propertiesSectionData);
    Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
    GridLayout propertiesGroupLayout = new GridLayout();
    propertiesGroupLayout.numColumns = 3;
    propertiesGroup.setLayout(propertiesGroupLayout);
    propertiesSection.setClient(propertiesGroup);
    return propertiesGroup;
  }

	/**
	 * @generated NOT
	 */
	protected Composite createNameText(FormToolkit widgetFactory, Composite parent) {
    FormUtils.createPartLabel(widgetFactory, parent, DeploymentMessages.ArtifactDeploymentDescriptionPropertiesEditionPart_NameLabel, propertiesEditionComponent.isRequired(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.name, DeploymentViewsRepository.FORM_KIND));
    name = widgetFactory.createText(parent, ""); //$NON-NLS-1$
    name.setEnabled(true);
    name.setEditable(false);
    name.setToolTipText(DeploymentMessages.ArtifactDeploymentDescription_ReadOnly);
    name.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    widgetFactory.paintBordersFor(parent);
    GridData nameData = new GridData(GridData.FILL_HORIZONTAL);
    name.setLayoutData(nameData);
    name.addFocusListener(new FocusAdapter() {
      /**
       * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
       * @generated
       */
      @Override
      @SuppressWarnings("synthetic-access")
      public void focusLost(FocusEvent e) {
        if (propertiesEditionComponent != null)
          propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ArtifactDeploymentDescriptionPropertiesEditionPartForm.this, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.name, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, name.getText()));
      }
    });
    name.addKeyListener(new KeyAdapter() {
      /**
       * @see org.eclipse.swt.events.KeyAdapter#keyPressed(org.eclipse.swt.events.KeyEvent)
       * @generated
       */
      @Override
      @SuppressWarnings("synthetic-access")
      public void keyPressed(KeyEvent e) {
        if (e.character == SWT.CR) {
          if (propertiesEditionComponent != null)
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ArtifactDeploymentDescriptionPropertiesEditionPartForm.this, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.name, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, name.getText()));
        }
      }
    });
    EditingUtils.setID(name, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.name);
    EditingUtils.setEEFtype(name, "eef::Text"); //$NON-NLS-1$
    FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.name, DeploymentViewsRepository.FORM_KIND), null); //$NON-NLS-1$
    return parent;
  }

	/**
	 * @generated NOT
	 */
	protected Composite createLocationText(FormToolkit widgetFactory, Composite parent) {
    FormUtils.createPartLabel(widgetFactory, parent, DeploymentMessages.ArtifactDeploymentDescriptionPropertiesEditionPart_LocationLabel, propertiesEditionComponent.isRequired(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.location, DeploymentViewsRepository.FORM_KIND));
    location = widgetFactory.createText(parent, ""); //$NON-NLS-1$
    location.setEnabled(true);
    location.setEditable(false);
    location.setToolTipText(DeploymentMessages.ArtifactDeploymentDescription_ReadOnly);
    location.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    widgetFactory.paintBordersFor(parent);
    GridData locationData = new GridData(GridData.FILL_HORIZONTAL);
    location.setLayoutData(locationData);
    location.addFocusListener(new FocusAdapter() {
      /**
       * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
       * @generated
       */
      @Override
      @SuppressWarnings("synthetic-access")
      public void focusLost(FocusEvent e) {
        if (propertiesEditionComponent != null)
          propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ArtifactDeploymentDescriptionPropertiesEditionPartForm.this, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.location, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, location.getText()));
      }
    });
    location.addKeyListener(new KeyAdapter() {
      /**
       * @see org.eclipse.swt.events.KeyAdapter#keyPressed(org.eclipse.swt.events.KeyEvent)
       * @generated
       */
      @Override
      @SuppressWarnings("synthetic-access")
      public void keyPressed(KeyEvent e) {
        if (e.character == SWT.CR) {
          if (propertiesEditionComponent != null)
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ArtifactDeploymentDescriptionPropertiesEditionPartForm.this, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.location, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, location.getText()));
        }
      }
    });
    EditingUtils.setID(location, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.location);
    EditingUtils.setEEFtype(location, "eef::Text"); //$NON-NLS-1$
    FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.location, DeploymentViewsRepository.FORM_KIND), null); //$NON-NLS-1$
    return parent;
  }

	/**
	 * @generated NOT
	 */
	protected Composite createNodeText(FormToolkit widgetFactory, Composite parent) {
    FormUtils.createPartLabel(widgetFactory, parent, DeploymentMessages.ArtifactDeploymentDescriptionPropertiesEditionPart_NodeLabel, propertiesEditionComponent.isRequired(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.node, DeploymentViewsRepository.FORM_KIND));
    node = widgetFactory.createText(parent, ""); //$NON-NLS-1$
    node.setEnabled(true);
    node.setEditable(false);
    node.setToolTipText(DeploymentMessages.ArtifactDeploymentDescription_ReadOnly);
    node.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    widgetFactory.paintBordersFor(parent);
    GridData nodeData = new GridData(GridData.FILL_HORIZONTAL);
    node.setLayoutData(nodeData);
    node.addFocusListener(new FocusAdapter() {
      /**
       * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
       * @generated
       */
      @Override
      @SuppressWarnings("synthetic-access")
      public void focusLost(FocusEvent e) {
        if (propertiesEditionComponent != null)
          propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ArtifactDeploymentDescriptionPropertiesEditionPartForm.this, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.node, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, node.getText()));
      }
    });
    node.addKeyListener(new KeyAdapter() {
      /**
       * @see org.eclipse.swt.events.KeyAdapter#keyPressed(org.eclipse.swt.events.KeyEvent)
       * @generated
       */
      @Override
      @SuppressWarnings("synthetic-access")
      public void keyPressed(KeyEvent e) {
        if (e.character == SWT.CR) {
          if (propertiesEditionComponent != null)
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ArtifactDeploymentDescriptionPropertiesEditionPartForm.this, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.node, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, node.getText()));
        }
      }
    });
    EditingUtils.setID(node, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.node);
    EditingUtils.setEEFtype(node, "eef::Text"); //$NON-NLS-1$
    FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.node, DeploymentViewsRepository.FORM_KIND), null); //$NON-NLS-1$
    return parent;
  }

	/**
	 * @generated NOT
	 */
	protected Composite createSourceText(FormToolkit widgetFactory, Composite parent) {
    FormUtils.createPartLabel(widgetFactory, parent, DeploymentMessages.ArtifactDeploymentDescriptionPropertiesEditionPart_SourceLabel, propertiesEditionComponent.isRequired(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.source, DeploymentViewsRepository.FORM_KIND));
    source = widgetFactory.createText(parent, ""); //$NON-NLS-1$
    source.setEnabled(true);
    source.setEditable(false);
    source.setToolTipText(DeploymentMessages.ArtifactDeploymentDescription_ReadOnly);
    source.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    widgetFactory.paintBordersFor(parent);
    GridData sourceData = new GridData(GridData.FILL_HORIZONTAL);
    source.setLayoutData(sourceData);
    source.addFocusListener(new FocusAdapter() {
      /**
       * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
       * @generated
       */
      @Override
      @SuppressWarnings("synthetic-access")
      public void focusLost(FocusEvent e) {
        if (propertiesEditionComponent != null)
          propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ArtifactDeploymentDescriptionPropertiesEditionPartForm.this, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.source, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, source.getText()));
      }
    });
    source.addKeyListener(new KeyAdapter() {
      /**
       * @see org.eclipse.swt.events.KeyAdapter#keyPressed(org.eclipse.swt.events.KeyEvent)
       * @generated
       */
      @Override
      @SuppressWarnings("synthetic-access")
      public void keyPressed(KeyEvent e) {
        if (e.character == SWT.CR) {
          if (propertiesEditionComponent != null)
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ArtifactDeploymentDescriptionPropertiesEditionPartForm.this, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.source, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, source.getText()));
        }
      }
    });
    EditingUtils.setID(source, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.source);
    EditingUtils.setEEFtype(source, "eef::Text"); //$NON-NLS-1$
    FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.source, DeploymentViewsRepository.FORM_KIND), null); //$NON-NLS-1$
    return parent;
  }

	/**
	 * @generated
	 */
	protected Composite createExecParametersGroup(FormToolkit widgetFactory, final Composite parent) {
    Section execParametersSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    execParametersSection.setText(DeploymentMessages.ArtifactDeploymentDescriptionPropertiesEditionPart_ExecParametersGroupLabel);
    GridData execParametersSectionData = new GridData(GridData.FILL_HORIZONTAL);
    execParametersSectionData.horizontalSpan = 3;
    execParametersSection.setLayoutData(execParametersSectionData);
    Composite execParametersGroup = widgetFactory.createComposite(execParametersSection);
    GridLayout execParametersGroupLayout = new GridLayout();
    execParametersGroupLayout.numColumns = 3;
    execParametersGroup.setLayout(execParametersGroupLayout);
    execParametersSection.setClient(execParametersGroup);
    return execParametersGroup;
  }

	/**
	 * @param container
	 * @generated NOT
	 */
	protected Composite createExecParameterTableComposition(FormToolkit widgetFactory, Composite container) {
    Composite tableContainer = widgetFactory.createComposite(container, SWT.NONE);
    GridLayout tableContainerLayout = new GridLayout();
    GridData tableContainerData = new GridData(GridData.FILL_BOTH);
    tableContainerData.horizontalSpan = 3;
    tableContainer.setLayoutData(tableContainerData);
    tableContainerLayout.numColumns = 2;
    tableContainer.setLayout(tableContainerLayout);
    org.eclipse.swt.widgets.Table tableExecParameter = widgetFactory.createTable(tableContainer, SWT.FULL_SELECTION | SWT.BORDER);
    tableExecParameter.setHeaderVisible(true);
    tableExecParameter.setEnabled(true);
    tableExecParameter.setToolTipText(DeploymentMessages.ArtifactDeploymentDescription_ReadOnly);
    GridData gdExecParameter = new GridData();
    gdExecParameter.grabExcessHorizontalSpace = true;
    gdExecParameter.horizontalAlignment = GridData.FILL;
    gdExecParameter.grabExcessVerticalSpace = true;
    gdExecParameter.verticalAlignment = GridData.FILL;
    tableExecParameter.setLayoutData(gdExecParameter);
    tableExecParameter.setLinesVisible(true);

    TableColumn name = new TableColumn(tableExecParameter, SWT.NONE);
    name.setWidth(80);
    name.setText("Name"); //$NON-NLS-1$
    
    TableColumn value = new TableColumn(tableExecParameter, SWT.NONE);
    value.setWidth(80);
    value.setText("Value"); //$NON-NLS-1$
    

    execParameter = new TableViewer(tableExecParameter);
    execParameter.setContentProvider(new ArrayContentProvider());
    execParameter.setLabelProvider(new ITableLabelProvider() {
    	public String getColumnText(Object object, int columnIndex) {
            if (object instanceof Property) {
              Property property = (Property) object;
          	  switch (columnIndex) {
              case 0:
                return property.getName();
              case 1:
              	Any value = property.getValue();
              	if(value != null) {
              		return value.toString();
              	} else {
              		return "";
              	}
              }
            }
            return ""; //$NON-NLS-1$
          }
      
            public Image getColumnImage(Object element, int columnIndex) {
              return null;
            }
      

      public void addListener(ILabelProviderListener listener) {
      }

      public void dispose() {
      }

      public boolean isLabelProperty(Object element, String property) {
        return false;
      }

      public void removeListener(ILabelProviderListener listener) {
      }

    });
    execParameter.getTable().addListener(SWT.MouseDoubleClick, new Listener(){

      public void handleEvent(Event event) {
        if (execParameter.getSelection() instanceof IStructuredSelection) {
          IStructuredSelection selection = (IStructuredSelection) execParameter.getSelection();
          if (selection.getFirstElement() instanceof EObject) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ArtifactDeploymentDescriptionPropertiesEditionPartForm.this, DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.ExecParameters.execParameter, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.EDIT, null, selection.getFirstElement()));
            execParameter.refresh();
          }
        }
      }

    });
    GridData execParameterData = new GridData(GridData.FILL_HORIZONTAL);
    execParameterData.minimumHeight = 120;
    execParameterData.heightHint = 120;
    execParameter.getTable().setLayoutData(execParameterData);
    for (ViewerFilter filter : this.execParameterFilters) {
      execParameter.addFilter(filter);
    }
    EditingUtils.setID(execParameter.getTable(), DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.ExecParameters.execParameter);
    EditingUtils.setEEFtype(execParameter.getTable(), "eef::TableComposition::field"); //$NON-NLS-1$
    createExecParameterPanel(widgetFactory, tableContainer);
    return container;
  }

	/**
	 * @param container
	 * @generated NOT
	 */
	protected Composite createExecParameterPanel(FormToolkit widgetFactory, Composite container) {
	    Composite execParameterPanel = widgetFactory.createComposite(container, SWT.NONE);
	    GridLayout execParameterPanelLayout = new GridLayout();
	    execParameterPanelLayout.numColumns = 1;
	    execParameterPanel.setLayout(execParameterPanelLayout);
	    return execParameterPanel;
	}

	/**
	 * @generated
	 */
	protected Composite createRequirementsGroup(FormToolkit widgetFactory, final Composite parent) {
    Section requirementsSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    requirementsSection.setText(DeploymentMessages.ArtifactDeploymentDescriptionPropertiesEditionPart_RequirementsGroupLabel);
    GridData requirementsSectionData = new GridData(GridData.FILL_HORIZONTAL);
    requirementsSectionData.horizontalSpan = 3;
    requirementsSection.setLayoutData(requirementsSectionData);
    Composite requirementsGroup = widgetFactory.createComposite(requirementsSection);
    GridLayout requirementsGroupLayout = new GridLayout();
    requirementsGroupLayout.numColumns = 3;
    requirementsGroup.setLayout(requirementsGroupLayout);
    requirementsSection.setClient(requirementsGroup);
    return requirementsGroup;
  }

	/**
	 * @param container
	 * @generated NOT
	 */
	protected Composite createDeployRequirementTableComposition(FormToolkit widgetFactory, Composite container) {
    Composite tableContainer = widgetFactory.createComposite(container, SWT.NONE);
    GridLayout tableContainerLayout = new GridLayout();
    GridData tableContainerData = new GridData(GridData.FILL_BOTH);
    tableContainerData.horizontalSpan = 3;
    tableContainer.setLayoutData(tableContainerData);
    tableContainerLayout.numColumns = 2;
    tableContainer.setLayout(tableContainerLayout);
    org.eclipse.swt.widgets.Table tableDeployRequirement = widgetFactory.createTable(tableContainer, SWT.FULL_SELECTION | SWT.BORDER);
    tableDeployRequirement.setHeaderVisible(true);
    tableDeployRequirement.setEnabled(true);
    tableDeployRequirement.setToolTipText(DeploymentMessages.ArtifactDeploymentDescription_ReadOnly);
    GridData gdDeployRequirement = new GridData();
    gdDeployRequirement.grabExcessHorizontalSpace = true;
    gdDeployRequirement.horizontalAlignment = GridData.FILL;
    gdDeployRequirement.grabExcessVerticalSpace = true;
    gdDeployRequirement.verticalAlignment = GridData.FILL;
    tableDeployRequirement.setLayoutData(gdDeployRequirement);
    tableDeployRequirement.setLinesVisible(true);

        TableColumn name = new TableColumn(tableDeployRequirement, SWT.NONE);
        name.setWidth(80);
        name.setText("Name"); //$NON-NLS-1$
        
        TableColumn resourceType = new TableColumn(tableDeployRequirement, SWT.NONE);
        resourceType.setWidth(80);
        resourceType.setText("Resource Type"); //$NON-NLS-1$
        
        TableColumn properties = new TableColumn(tableDeployRequirement, SWT.NONE);
        properties.setWidth(80);
        properties.setText("Properties"); //$NON-NLS-1$
    

    deployRequirement = new TableViewer(tableDeployRequirement);
    deployRequirement.setContentProvider(new ArrayContentProvider());
    deployRequirement.setLabelProvider(new ITableLabelProvider() {
            public String getColumnText(Object object, int columnIndex) {
              if (object instanceof Requirement) {
            	  Requirement req = (Requirement) object;
                switch (columnIndex) {
                case 0:
                  return req.getName();
                case 1:
                	return req.getResourceType();
                }
              }
              return ""; //$NON-NLS-1$
            }
      
            public Image getColumnImage(Object element, int columnIndex) {
              return null;
            }
      

      public void addListener(ILabelProviderListener listener) {
      }

      public void dispose() {
      }

      public boolean isLabelProperty(Object element, String property) {
        return false;
      }

      public void removeListener(ILabelProviderListener listener) {
      }

    });
    GridData deployRequirementData = new GridData(GridData.FILL_HORIZONTAL);
    deployRequirementData.minimumHeight = 120;
    deployRequirementData.heightHint = 120;
    deployRequirement.getTable().setLayoutData(deployRequirementData);
    for (ViewerFilter filter : this.deployRequirementFilters) {
      deployRequirement.addFilter(filter);
    }
    EditingUtils.setID(deployRequirement.getTable(), DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.Requirements.deployRequirement);
    EditingUtils.setEEFtype(deployRequirement.getTable(), "eef::TableComposition::field"); //$NON-NLS-1$
    createDeployRequirementPanel(widgetFactory, tableContainer);
    return container;
  }

	/**
	 * @param container
	 * @generated NOT
	 */
	protected Composite createDeployRequirementPanel(FormToolkit widgetFactory, Composite container) {
    Composite deployRequirementPanel = widgetFactory.createComposite(container, SWT.NONE);
    GridLayout deployRequirementPanelLayout = new GridLayout();
    deployRequirementPanelLayout.numColumns = 1;
    deployRequirementPanel.setLayout(deployRequirementPanelLayout);
    return deployRequirementPanel;
  }

	/**
	 * @generated
	 */
	protected Composite createResourcesGroup(FormToolkit widgetFactory, final Composite parent) {
    Section resourcesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    resourcesSection.setText(DeploymentMessages.ArtifactDeploymentDescriptionPropertiesEditionPart_ResourcesGroupLabel);
    GridData resourcesSectionData = new GridData(GridData.FILL_HORIZONTAL);
    resourcesSectionData.horizontalSpan = 3;
    resourcesSection.setLayoutData(resourcesSectionData);
    Composite resourcesGroup = widgetFactory.createComposite(resourcesSection);
    GridLayout resourcesGroupLayout = new GridLayout();
    resourcesGroupLayout.numColumns = 3;
    resourcesGroup.setLayout(resourcesGroupLayout);
    resourcesSection.setClient(resourcesGroup);
    return resourcesGroup;
  }

	/**
	 * @param container
	 * @generated NOT
	 */
	protected Composite createDeployResourceTableComposition(FormToolkit widgetFactory, Composite container) {
    Composite tableContainer = widgetFactory.createComposite(container, SWT.NONE);
    GridLayout tableContainerLayout = new GridLayout();
    GridData tableContainerData = new GridData(GridData.FILL_BOTH);
    tableContainerData.horizontalSpan = 3;
    tableContainer.setLayoutData(tableContainerData);
    tableContainerLayout.numColumns = 2;
    tableContainer.setLayout(tableContainerLayout);
    org.eclipse.swt.widgets.Table tableDeployResource = widgetFactory.createTable(tableContainer, SWT.FULL_SELECTION | SWT.BORDER);
    tableDeployResource.setHeaderVisible(true);
    tableDeployResource.setEnabled(true);
    tableDeployResource.setToolTipText(DeploymentMessages.ArtifactDeploymentDescription_ReadOnly);
    GridData gdDeployResource = new GridData();
    gdDeployResource.grabExcessHorizontalSpace = true;
    gdDeployResource.horizontalAlignment = GridData.FILL;
    gdDeployResource.grabExcessVerticalSpace = true;
    gdDeployResource.verticalAlignment = GridData.FILL;
    tableDeployResource.setLayoutData(gdDeployResource);
    tableDeployResource.setLinesVisible(true);

        TableColumn resourceName = new TableColumn(tableDeployResource, SWT.NONE);
        resourceName.setWidth(80);
        resourceName.setText("Resource Name"); //$NON-NLS-1$
        
        TableColumn requirementName = new TableColumn(tableDeployResource, SWT.NONE);
        requirementName.setWidth(80);
        requirementName.setText("Requirement Name"); //$NON-NLS-1$
        
        TableColumn properties = new TableColumn(tableDeployResource, SWT.NONE);
        properties.setWidth(80);
        properties.setText("Properties"); //$NON-NLS-1$

    deployResource = new TableViewer(tableDeployResource);
    deployResource.setContentProvider(new ArrayContentProvider());
    deployResource.setLabelProvider(new ITableLabelProvider() {
            public String getColumnText(Object object, int columnIndex) {
              if (object instanceof ResourceDeploymentDescription) {
            	  ResourceDeploymentDescription resourceDeployment = (ResourceDeploymentDescription) object;
            	  switch (columnIndex) {
                case 0:
                  return resourceDeployment.getResourceName();
                case 1:
                	return resourceDeployment.getRequirementName();
                }
              }
              return ""; //$NON-NLS-1$
            }
      
            public Image getColumnImage(Object element, int columnIndex) {
              return null;
            }
      

      public void addListener(ILabelProviderListener listener) {
      }

      public void dispose() {
      }

      public boolean isLabelProperty(Object element, String property) {
        return false;
      }

      public void removeListener(ILabelProviderListener listener) {
      }

    });
    
    GridData deployResourceData = new GridData(GridData.FILL_HORIZONTAL);
    deployResourceData.minimumHeight = 120;
    deployResourceData.heightHint = 120;
    deployResource.getTable().setLayoutData(deployResourceData);
    for (ViewerFilter filter : this.deployResourceFilters) {
      deployResource.addFilter(filter);
    }
    EditingUtils.setID(deployResource.getTable(), DeploymentViewsRepository.ArtifactDeploymentDescription.Properties.Resources.deployResource);
    EditingUtils.setEEFtype(deployResource.getTable(), "eef::TableComposition::field"); //$NON-NLS-1$
    createDeployResourcePanel(widgetFactory, tableContainer);
    return container;
  }

	/**
	 * @param container
	 * @generated NOT
	 */
	protected Composite createDeployResourcePanel(FormToolkit widgetFactory, Composite container) {
    Composite deployResourcePanel = widgetFactory.createComposite(container, SWT.NONE);
    GridLayout deployResourcePanelLayout = new GridLayout();
    deployResourcePanelLayout.numColumns = 1;
    deployResourcePanel.setLayout(deployResourcePanelLayout);
    return deployResourcePanel;
  }



	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionListener#firePropertiesChanged(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
	 * @generated
	 */
	public void firePropertiesChanged(IPropertiesEditionEvent event) {
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#getName()
	 * @generated
	 */
	public String getName() {
    return name.getText();
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#setName(String newValue)
	 * @generated
	 */
	public void setName(String newValue) {
    if (newValue != null) {
      name.setText(newValue);
    } else {
      name.setText(""); //$NON-NLS-1$
    }
  }


	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#getLocation()
	 * @generated
	 */
	public String getLocation() {
    return location.getText();
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#setLocation(String newValue)
	 * @generated
	 */
	public void setLocation(String newValue) {
    if (newValue != null) {
      location.setText(newValue);
    } else {
      location.setText(""); //$NON-NLS-1$
    }
  }


	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#getNode()
	 * @generated
	 */
	public String getNode() {
    return node.getText();
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#setNode(String newValue)
	 * @generated
	 */
	public void setNode(String newValue) {
    if (newValue != null) {
      node.setText(newValue);
    } else {
      node.setText(""); //$NON-NLS-1$
    }
  }


	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#getSource()
	 * @generated
	 */
	public String getSource() {
    return source.getText();
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#setSource(String newValue)
	 * @generated
	 */
	public void setSource(String newValue) {
    if (newValue != null) {
      source.setText(newValue);
    } else {
      source.setText(""); //$NON-NLS-1$
    }
  }




	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#initExecParameter(EObject current, EReference containingFeature, EReference feature)
	 */
	public void initExecParameter(ReferencesTableSettings settings) {
		if (current.eResource() != null && current.eResource().getResourceSet() != null)
			this.resourceSet = current.eResource().getResourceSet();
		ReferencesTableContentProvider contentProvider = new ReferencesTableContentProvider();
		execParameter.setContentProvider(contentProvider);
		execParameter.setInput(settings);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#updateExecParameter()
	 * @generated
	 */
	public void updateExecParameter() {
  execParameter.refresh();
}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#addFilterExecParameter(ViewerFilter filter)
	 * @generated
	 */
	public void addFilterToExecParameter(ViewerFilter filter) {
    execParameterFilters.add(filter);
    if (this.execParameter != null) {
      this.execParameter.addFilter(filter);
    }
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#addBusinessFilterExecParameter(ViewerFilter filter)
	 * @generated
	 */
	public void addBusinessFilterToExecParameter(ViewerFilter filter) {
    execParameterBusinessFilters.add(filter);
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#isContainedInExecParameterTable(EObject element)
	 * @generated
	 */
	public boolean isContainedInExecParameterTable(EObject element) {
    return ((ReferencesTableSettings)execParameter.getInput()).contains(element);
  }




	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#initDeployRequirement(EObject current, EReference containingFeature, EReference feature)
	 */
	public void initDeployRequirement(ReferencesTableSettings settings) {
		if (current.eResource() != null && current.eResource().getResourceSet() != null)
			this.resourceSet = current.eResource().getResourceSet();
		ReferencesTableContentProvider contentProvider = new ReferencesTableContentProvider();
		deployRequirement.setContentProvider(contentProvider);
		deployRequirement.setInput(settings);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#updateDeployRequirement()
	 * @generated
	 */
	public void updateDeployRequirement() {
  deployRequirement.refresh();
}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#addFilterDeployRequirement(ViewerFilter filter)
	 * @generated
	 */
	public void addFilterToDeployRequirement(ViewerFilter filter) {
    deployRequirementFilters.add(filter);
    if (this.deployRequirement != null) {
      this.deployRequirement.addFilter(filter);
    }
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#addBusinessFilterDeployRequirement(ViewerFilter filter)
	 * @generated
	 */
	public void addBusinessFilterToDeployRequirement(ViewerFilter filter) {
    deployRequirementBusinessFilters.add(filter);
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#isContainedInDeployRequirementTable(EObject element)
	 * @generated
	 */
	public boolean isContainedInDeployRequirementTable(EObject element) {
    return ((ReferencesTableSettings)deployRequirement.getInput()).contains(element);
  }




	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#initDeployResource(EObject current, EReference containingFeature, EReference feature)
	 */
	public void initDeployResource(ReferencesTableSettings settings) {
		if (current.eResource() != null && current.eResource().getResourceSet() != null)
			this.resourceSet = current.eResource().getResourceSet();
		ReferencesTableContentProvider contentProvider = new ReferencesTableContentProvider();
		deployResource.setContentProvider(contentProvider);
		deployResource.setInput(settings);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#updateDeployResource()
	 * @generated
	 */
	public void updateDeployResource() {
  deployResource.refresh();
}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#addFilterDeployResource(ViewerFilter filter)
	 * @generated
	 */
	public void addFilterToDeployResource(ViewerFilter filter) {
    deployResourceFilters.add(filter);
    if (this.deployResource != null) {
      this.deployResource.addFilter(filter);
    }
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#addBusinessFilterDeployResource(ViewerFilter filter)
	 * @generated
	 */
	public void addBusinessFilterToDeployResource(ViewerFilter filter) {
    deployResourceBusinessFilters.add(filter);
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart#isContainedInDeployResourceTable(EObject element)
	 * @generated
	 */
	public boolean isContainedInDeployResourceTable(EObject element) {
    return ((ReferencesTableSettings)deployResource.getInput()).contains(element);
  }




	/**
	 * {@inheritDoc}
	 *
	 * @see org.eclipse.emf.eef.runtime.api.parts.IPropertiesEditionPart#getTitle()
	 * @generated
	 */
	public String getTitle() {
    return DeploymentMessages.ArtifactDeploymentDescription_Part_Title;
  }



}
